/***************************************************************************
 *   Copyright 2010 long2015 liu <long2015@gmail.com>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public
 *   License as published by the Free Software Foundation; either
 *   version 2 of the License, or (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 ***************************************************************************/

#ifndef JIGSAW_H
#define JIGSAW_H

#include<QWidget>
#include<QtGui>
#include<QPixmap>
#include<QLabel>

class Jigsaw : public QWidget
{
    Q_OBJECT
public :
        Jigsaw(QWidget *parent = 0);
        void keyReleaseEvent ( QKeyEvent * event );
        bool isSucceed();
    private slots:
        void open();
        void makeImg();
        void disorder();
protected :
        void paintEvent(QPaintEvent *);
private :
        QLabel *label1;
        QLabel *label2;
        QPushButton *fileButton;
        QPushButton *disorderButton;
        QString fileName;
        QPoint point[9];
        int n[9];
        int blank;
        QPixmap img;  //
        QPixmap image[9];

        void setText(int);
        void exchangePoint(int);

};

#endif // JIGSAW_H
